<template>
	<view class="popup_template_container" :class="[className,type==2?'popup_transparent_content':'']">
		<u-popup :show="visible" mode="center" round="24" :closeable="type==1" :safeAreaInsetBottom="false"
			@close="close" @open="open">
			<view class="pop_content p_16 bc_fff br_12 flow_h" :style="[bodyStyle]">
				<view class="fz_18 fc_666 fc" v-if="title">
					{{title}}
				</view>
				<slot />
			</view>
			<view class="mt_24 fx jcc" v-if="type==2&&closeable">
				<u-icon name="close-circle" color="#fff" size="48" @click="close"></u-icon>
			</view>
		</u-popup>
	</view>
</template>

<script>
	export default {
		props: {
			type: {
				type: [String, Number],
				default: 1,
			},
			visible: {
				type: Boolean,
				default: false
			},
			title: {
				type: String,
				default: '',
			},
			className: {
				type: String,
				default: '',
			},
			closeable: {
				type: Boolean,
				default: true
			},
			bodyStyle: {
				type: Object,
				default: () => ({})
			}
		},
		computed: {
			customStyle1() {
				return this.type == 2 ? {
					'background-color': 'transparent'
				} : {}
			}
		},
		methods: {
			open() {
				// console.log('open');
			},
			close() {
				this.$emit('update:visible', false)
				// console.log('close');
			}
		}
	}
</script>

<style lang="scss">
	.pop_content {
		width: 600rpx;
	}
</style>